package com.example.optimizeapplication.receive;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Vibrator;
import android.util.Log;

public class ShockReceiver extends BroadcastReceiver {
    public static  final String action = "quitness_action";

    @Override
    public void onReceive(Context context, Intent intent) {

        if (intent != null && intent.getAction().equals(action)){
            Log.d("sp", "震动了一下");

            //从系统服务中获取震动管理器
            Vibrator vb = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
            vb.vibrate(500);
        }

    }
}